﻿using System;
using System.Text.RegularExpressions;

namespace ValidationHelper.Validators
{
    public class RegexValidator : StringValidator
    {
        #region Propriedades
        public string RegularExpression { get; set; }
        #endregion

        #region Construtores
        public RegexValidator(string message, Type exceptionType, string stringToValidate, string regularExpression)
            : base(message, exceptionType, stringToValidate)
        {
            RegularExpression = regularExpression;
        }
        #endregion

        #region Métodos
        protected override bool IsNotValid()
        {
            return (!Regex.IsMatch(StringToValidate, RegularExpression));
        }
        #endregion
    }
}
